package com.mypage.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.cloudcc.mobile.R;
import com.cloudcc.mobile.adapter.DraftBoxAdapter;
import com.cloudcc.mobile.im.adapter.MemberAdapter;
import com.mypage.bean.CnumberBean;

import java.util.List;

/**
 * Created by Administrator on 2017/10/16 0016.
 */

public class NSystemAdapter extends BaseAdapter {



    private Context mContext;
    private List<CnumberBean.NumberData> guanzhudatea;
    private LayoutInflater inflater;
    private String isguanzhu_x;


    public NSystemAdapter(Context mContext, List<CnumberBean.NumberData> guanzhudatea, String isguanzhu_x) {
        this.mContext = mContext;
        this.guanzhudatea = guanzhudatea;
        this.isguanzhu_x = isguanzhu_x;
        inflater = LayoutInflater.from(mContext);


    }




    @Override
    public int getCount() {
        if (!guanzhudatea.isEmpty()){
            if (guanzhudatea.size()==0){
                return 0;
            }
        }
        return guanzhudatea.size();
    }

    @Override
    public Object getItem(int i) {
        return guanzhudatea.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View convertView, ViewGroup viewGroup) {
        ViewHolder holder = null;
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(
                    R.layout.message_list_item, null);
            holder = new ViewHolder();
            holder.name = (TextView) convertView.findViewById(R.id.name);
            holder.context = (TextView) convertView.findViewById(R.id.context);
            holder.time = (TextView) convertView.findViewById(R.id.time);
            convertView.setTag(holder);

        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.context.setText(guanzhudatea.get(i).content);
        holder.time.setText(guanzhudatea.get(i).createdate);
        return convertView;
    }
    class ViewHolder {
        TextView name;
        TextView time;
        TextView context;

    }
}
